import 'package:gluz/generated/json/base/json_convert_content.dart';
import 'package:gluz/app/data/shop/shop_param_entity.dart';

ShopParamEntity $ShopParamEntityFromJson(Map<String, dynamic> json) {
  final ShopParamEntity shopParamEntity = ShopParamEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    shopParamEntity.id = id;
  }
  final String? productId = jsonConvert.convert<String>(json['productId']);
  if (productId != null) {
    shopParamEntity.productId = productId;
  }
  final String? attrType = jsonConvert.convert<String>(json['attrType']);
  if (attrType != null) {
    shopParamEntity.attrType = attrType;
  }
  final String? attrName = jsonConvert.convert<String>(json['attrName']);
  if (attrName != null) {
    shopParamEntity.attrName = attrName;
  }
  final String? attrValue = jsonConvert.convert<String>(json['attrValue']);
  if (attrValue != null) {
    shopParamEntity.attrValue = attrValue;
  }
  final int? sortOrder = jsonConvert.convert<int>(json['sortOrder']);
  if (sortOrder != null) {
    shopParamEntity.sortOrder = sortOrder;
  }
  return shopParamEntity;
}

Map<String, dynamic> $ShopParamEntityToJson(ShopParamEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['productId'] = entity.productId;
  data['attrType'] = entity.attrType;
  data['attrName'] = entity.attrName;
  data['attrValue'] = entity.attrValue;
  data['sortOrder'] = entity.sortOrder;
  return data;
}

extension ShopParamEntityExtension on ShopParamEntity {
  ShopParamEntity copyWith({
    int? id,
    String? productId,
    String? attrType,
    String? attrName,
    String? attrValue,
    int? sortOrder,
  }) {
    return ShopParamEntity()
      ..id = id ?? this.id
      ..productId = productId ?? this.productId
      ..attrType = attrType ?? this.attrType
      ..attrName = attrName ?? this.attrName
      ..attrValue = attrValue ?? this.attrValue
      ..sortOrder = sortOrder ?? this.sortOrder;
  }
}